import java.sql.Time;
import java.util.Timer;
import java.util.TimerTask;

public class Test3 {
    //使用定时器
    public static void main(String[] args) {
        Timer timer = new Timer();
        timer.schedule(new TimerTask() {
            @Override
            public void run() {
                System.out.println("我是Runnable的子类,5000");
            }
        },5000);
        timer.schedule(new TimerTask() {
            @Override
            public void run() {
                System.out.println("我是Runnable的子类,3000");
            }
        },3000);
        timer.schedule(new TimerTask() {
            @Override
            public void run() {
                System.out.println("我是Runnable的子类,1000");
            }
        },1000);
    }
}
